<template>
	<view class="my-bill-detail">
		<view class="header">
			<view class="banner">
				<view class="content blue" v-if="rentInfo.stage_status == -1">
					<view class="top-txt">已完成</view>
					<view class="middle-txt">该账单已还清</view>
					<view class="bottom-txt">钱包有钱 可提前还款</view>
				</view>
				<view class="content blue" v-if="rentInfo.stage_status == 0">
					<view class="top-txt">本期待还账单 (元)</view>
					<view class="middle-txt">本期已还清</view>
					<view class="bottom-txt">钱包有钱 可提前还款</view>
				</view>
				<view class="content green" v-if="rentInfo.stage_status == 1">
					<view class="top-txt">本期待还账单 (元)</view>
					<view class="middle-txt">¥{{rentInfo.next_wait_price}}</view>
					<view class="bottom-txt">{{rentInfo.end_date}}前还款，支持提前还款</view>
					<!-- <view class="bottom-txt">每月{{rentInfo.overdue_day}}号出账 当天还款</view> -->
				</view>
				<view class="content red" v-if="rentInfo.stage_status == 2">
					<view class="top-txt">本期待还账单 (元)</view>
					<view class="middle-txt">¥{{rentInfo.next_wait_price}}<text class="overdue">已逾期{{rentInfo.overdue_day}}天</text></view>
					<!-- <view class="bottom-txt">每月{{rentInfo.overdue_day}}号出账 当天还款</view> -->
					<view class="bottom-txt">{{rentInfo.end_date}}前还款，支持提前还款</view>
				</view>
				
				<view class="repaid0" v-if="rentInfo.stage_status == 0" @click="goRepaid(o_id)">
					<view>已还</view>
					<view>账单</view>
				</view>
				<view class="repaid1" v-if="rentInfo.stage_status == 1" @click="goRepaid(o_id)">
					<view>已还</view>
					<view>账单</view>
				</view>
				<view class="repaid2" v-if="rentInfo.stage_status == 2" @click="goRepaid(o_id)">
					<view>已还</view>
					<view>账单</view>
				</view>
			</view>
			<view class="rent-info" v-if="rentInfo.stage_status != -1">
				<view class="item" @click="showWaitPay">
					<view class="name">剩余租金</view>
					<view class="txt">¥{{rentInfo.wait_price}}</view>
				</view>
				
				<view class="h-line"></view>
				<view class="item">
					<view class="name" v-if="rentInfo.stage_status == 0">本期已还清</view>
					<view class="name" v-if="rentInfo.stage_status == 1 || rentInfo.stage_status == 2">本期应还</view>
					<view class="txt" v-if="rentInfo.stage_status == 0">下期待还¥{{rentInfo.next_wait_price}}</view>
					<view class="txt" v-else>本期待还¥{{rentInfo.next_wait_price}}</view>
				</view>
			</view>
		</view>
		<view class="mb-section">
			<view class="order-id">订单编号：<text class="num">{{order_id}}</text></view>
			<view class="bill-info">
				<image class="b-pic"
					:src="orderInfo.cartInfo[0].productInfo.image">
				</image>
				<view class="spec-info">
					<view class="title m-ellipsis">{{orderInfo.cartInfo[0].productInfo.store_name}}</view>
					<view class="sub">已选择：{{orderInfo.bill.lease_way}}；{{orderInfo.cartInfo[0].productInfo.attrInfo.suk}}；{{orderInfo.lease_term.label}}；1件</view>
					<view class="sub mt8">总租金：¥{{orderInfo.rent_price}}</view>
					<view class="sub mt8">意外险：¥{{orderInfo.broker_screen_insurance}}</view>
				</view>
			</view>
			<!-- <view class="chart-info">
				<view class="left-chart">
					<qiun-data-charts type="ring" :opts="opts" :chartData="chartData" />
				</view>
				<view class="right-content">
					<view class="total-item">
						<view class="num" style="color: #FFA85C;">{{rentInfo.payable_price}}</view>
						<view class="name">应还租金 (元)</view>
					</view>
					
					<view class="total-item">
						<view class="num" style="color: #29CC80;">{{rentInfo.paid_price}}</view>
						<view class="name">已还租金 (元)</view>
					</view>
					<view class="wait">其中待还租金：¥{{rentInfo.wait_price}}</view>
				</view>
			</view> -->
		</view>
		
		<view class="mb-section" v-if="wait_list.length > 0">
			<view class="p-title" style="padding-top: 30rpx;">
				<view>本期待付</view>
				<view class="title-right" @click="toOverdue()">
					<image class="icon-overdue" src="../../static/images/icon-overdue.png"></image>
					<view>征信授权书</view>
				</view>
			</view>
<!-- 			<view class="top-box">
				<view class="left">
					<view class="sub-title">{{rentInfo.wait_list[0].start_date}}应还（元）</view>
					<view class="sum">{{rentInfo.wait_list[0].stage_price}}</view>
				</view>
				<view class="to-pay">立即还款</view>
			</view> -->
			<!-- <view class="note">进过对你的综合评估，您首次应付3期的租金</view> -->
			
			<view class="data-list">
				<view class="item" v-for="(item, index) in wait_list">
					<view class="content">
						<view class="left" @click="selectId(index)">
							<image v-if="item.select && appType == 2" class="check-img" src="../../static/images/ic-check2.png"></image>
							<image v-else-if="item.select && appType == 1" class="check-img" src="../../static/images/ic-check1.png"></image>
							<image v-else-if="item.select" class="check-img" src="../../static/images/ic-check.png"></image>
							<image v-else class="check-img" src="../../static/images/ic-uncheck.png"></image>
						</view>
						<view class="middle">
							<!-- <text v-if="item.is_first == 1" class="count">首期支付 {{item.stage}}/{{item.count}}期</text> -->
							<text class="count">{{item.stage}}/{{item.count}}期 <text v-if="item.is_submit_credit == 1" class="reported">征信已上报</text><text v-else class="report">征信未上报</text></text>
							<view class="time">{{item.end_date}}前，<text class="red"><text class="red" v-if="item.is_overdue">逾期</text v-else>待还</text></view>
						</view>
						<view class="right">
							<view class="num">¥{{item.total_stage_price}}</view>
							<view class="money-add">含租金¥{{item.stage_price}}<text v-if="item.is_overdue">+¥违约金{{item.overdue_price}}</text></view>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<view class="mb-section" v-if="rentInfo.stage_status == -1">
			<view class="p-title" style="padding: 32rpx 0;">
				<view>还款记录</view>
			</view>
			
			<view class="data-list">
				<view class="item" v-for="(item, index) in rentInfo.paid_list">
					<view class="stage">
						<!-- <text v-if="item.is_first == 1">首期 {{item.stage}}/{{item.count}}期</text> -->
						<text>{{item.stage}}/{{item.count}}期</text>
						<text class="num">¥{{item.total_stage_price}}</text>

					</view>
					<view class="info">
						<view class="time">{{item.pay_time}}，<text class="green">已还</text></view>
						<view class="price">含租金¥{{item.stage_price}}<text v-if="item.is_overdue">+违约金¥{{item.overdue_price}}</text></view>
					</view>
				</view>
				
			</view>
		</view>
		
		<view style="height: 150rpx;" v-if="rentInfo.stage_status != -1"></view>
		 <!-- v-if="bottomShow" -->
		<view class="mb-flex-box"  v-if="rentInfo.stage_status != -1">
			<view class="coupon-list" >
				<view class="name">
					优惠卡包
				</view>
				<view @click="couponTap">
					<text v-if="couponId == 0" class="num" :class="couponCount == 0 ? 'emptyNum' : ''">{{couponCount == 0 ? '暂无可用优惠券' : couponCount + '张优惠券可用'}}</text>
					<text v-else>已选{{couponTitle}}</text>
				</view>
			</view>
	
			<view class="bottom-btn">
				<view class="btn prev app-btn1" v-if="!waitPay.waitPay" @click="showWaitPay">提前还款</view>
				<view style="width: 20rpx;" v-if="!waitPay.waitPay"></view>
				<view class="btn next app-btn-bg" @click="toPay" v-if="wait_list.length > 0 || waitPay.waitPay">立即还款</view>
			</view>
	
		</view>
	
		<couponListWindow :coupon='coupon' @ChangCouponsClone="ChangCouponsClone" :openType='openType' 
					@ChangCoupons="ChangCoupons"></couponListWindow>
					
		<waitPayListWindow  @selectItems="selectItems" :waitPay='waitPay' @ChangWaitPayClone="ChangWaitPayClone"></waitPayListWindow>
		
		<payWindow :payMode="payMode" :pay_close="pay_close" @onChangeFun="onChangeFun" :order_id="pay_order_id"></payWindow>
	</view>
</template>

<script>
	import {
		HTTP_REQUEST_URL
	} from '@/config/app';
	let app = getApp();
	import waitPayListWindow from '@/components/waitPayListWindow';
	import couponListWindow from '@/components/couponListWindow';
	import payWindow from '@/components/payWindow';
	import {
		getOrderDetail,
		getStageBillList,
		getStageBillDetail,
		getStageBillPay2,
		getCouponsOrderBillId,
	} from '@/api/order.js';
	export default {
		components: {
			couponListWindow,
			waitPayListWindow,
			payWindow
		},
		data() {
			return {
				isFirst: true,
				loaded: false,
				type: 0,
				appType: app.globalData.appType,
				couponTitle: '', //优惠券
				couponCount: 0,
				bottomShow: false,
				couponId: 0, //优惠券id
				openType: 1, //优惠券打开方式 1=使用
				checkId: 0,
				rentInfo: {},
				orderInfo: {},
				order_id: '',
				o_id: '',
				chartData: {},
				opts: {
					rotate: false,
					rotateLock: false,
					color: ["#FFA85C", "#FF271F", "#29CC80"],
					padding: [0, 0, 0, 0],
					dataLabel: false,
					enableScroll: false,
					legend: {
						show: false,
						position: "right",
						lineHeight: 25
					},
					title: {
						name: "",
						fontSize: 14,
						offsetY: -4,
						color: "#1F1F1F"
					},
					subtitle: {
						name: "总租金 (元)",
						fontSize: 12,
						offsetY: 2,
						color: "#999999"
					},
					extra: {
						ring: {
							ringWidth: 18,
							activeOpacity: 0.5,
							activeRadius: 0,
							offsetAngle: 0,
							labelWidth: 15,
							border: true,
							borderWidth: 3,
							borderColor: "#FFFFFF"
						}
					}
				},
				orerInfo: {},
				wait_list: [],
				coupon: {
					coupon: false,
					list: [],
					statusTile: '立即使用'
				}, //优惠券组件
				waitPay: {
					waitPay: false,
					list: []
				},
				payMode: [
				// {
				// 	name: '微信支付',
				// 	icon: 'icon-weixinzhifu',
				// 	value: 'weixin',
				// 	title: '使用微信快捷支付',
				// 	payStatus: true
				// },
					{
						name: '支付宝支付',
						icon: 'icon-zhifubao',
						value: 'alipay',
						title: '使用线上支付宝支付',
						payStatus: true
					},
					{
						name: '银行卡支付',
						icon: 'icon-yuezhifu',
						value: 'yee_yjzf',
						title: '当前可用余额：',
						number: 0,
						payStatus: true
					}
				],
				pay_close: false,
				pay_order_id: '',
				selectIds: []
			};
		},
		onLoad(options) {
			const that = this
			this.$set(this, 'order_id', options.order_id);
			this.$set(this, 'o_id', options.o_id);
			if (options.type) {
				this.$set(this, 'type', options.type);
			}
				
		},
		onShow() {
			this.getServerData();
		},
		methods: {
			toOverdue() {
				const url = HTTP_REQUEST_URL + '/zxsqs.html'
				uni.navigateTo({
					url: `/pages/annex/web_view/index?url=${url}`
				});
			},
			goRepaid(oid) {
				uni.navigateTo({
					url: '/pages/lease/repaid-list?order_id=' + this.o_id
				})
			},
			/**
			 * 处理点击优惠券后的事件
			 * 
			 */
			ChangCoupons: function(e) {
				let index = e,
					list = this.coupon.list,
					couponTitle = '请选择',
					couponId = 0;
					
					
				// for (let i = 0, len = list.length; i < len; i++) {
				// 	if (i != index) {
				// 		list[i].use_title = '';
				// 		list[i].is_use = 0;
				// 	}
				// }
				// if (list[index].is_use) {
				// 	//不使用优惠券
				// 	list[index].use_title = '';
				// 	list[index].is_use = 0;
				// } else {
				// 	//使用优惠券
				// 	list[index].use_title = '不使用';
				// 	list[index].is_use = 1;
				
					this.couponTitle = list[index].coupon_title;
					couponId = list[index].id;
				// }
				// this.couponTitle = couponTitle;
				this.couponId = couponId;
				this.$set(this.coupon, 'coupon', false);
				this.$set(this.coupon, 'list', list);
				
			},
			
			showWaitPay() {
				this.waitPay.waitPay = true;
				
				let selectCouponId = []
				this.waitPay.list.forEach((item, index) => {
					if (item.select) {
						selectCouponId.push(item.id)
					}
				})
				
				if (selectCouponId.length > 0) {
					this.couponCount = 0 
					this.couponId = 0
					this.getCouponList(this.o_id, selectCouponId)
				} else {
					this.couponCount = 0 
					this.couponId = 0
				}
			
			},
			
			couponTap() {
				this.coupon.coupon = true;
				this.coupon.list.forEach((item, index) => {
					if (item.id == this.couponId) {
						item.is_use = 1
					} else {
						item.is_use = 0
					}
				})
				this.$set(this.coupon, 'list', this.coupon.list);
			},
			ChangCouponsClone: function() {
				this.$set(this.coupon, 'coupon', false);
			},
			selectItems: function(index) {
				const arri = this.waitPay.list
				arri[index].select = !arri[index].select
				this.waitPay.list.splice.call(this.waitPay.list, 0, this.waitPay.list.length, ...arri)
			
				let selectCouponId = []
				this.waitPay.list.forEach((item, index) => {
					if (item.select) {
						selectCouponId.push(item.id)
					}
				})
				
				if (selectCouponId.length > 0) {
					this.bottomShow = true
					this.couponId = 0
					this.getCouponList(this.o_id, selectCouponId)
				} else {
					this.$set(this, 'bottomShow', false);
					this.$set(this, 'couponId', 0);
					this.$set(this, 'checkId', 0);
					this.ChangCouponsClone()
				}
			},
			ChangWaitPayClone: function() {
				this.$set(this.waitPay, 'waitPay', false);
				
				let selectCouponId = []
				this.wait_list.forEach((item, index) => {
					if (item.select) {
						selectCouponId.push(item.id)
					}
				})
				
				if (selectCouponId.length > 0) {
					this.couponId = 0
					this.couponCount = 0 
					this.getCouponList(this.o_id, selectCouponId)
				} else {
					this.coupon.list = []
					this.couponCount = 0 
					this.couponId = 0
				}
			},
			getCouponList(id, ids) {
				console.log(ids)
				let that = this;
				getCouponsOrderBillId(id, {
					bill_id: ids
				}).then(res => {
					that.$set(that.coupon, 'list', res.data.result);
					that.$set(that, 'couponCount', res.data.count);
				});
			},
			selectId(index) {
				const arri = this.wait_list
				
				if (arri[index].is_first == true) {
					uni.showToast({
						title: '首期不能取消'
					})
					return
				}
				
				arri[index].select = !arri[index].select
				this.wait_list.splice.call(this.wait_list, 0, this.wait_list.length, ...arri)
				
				let selectCouponId = []
				this.wait_list.forEach((item, index) => {
					if (item.select) {
						selectCouponId.push(item.id)
					}
				})
				
				
				if (selectCouponId.length > 0) {
					this.bottomShow = true
					this.couponId = 0
					this.coupon.list = []
					this.getCouponList(this.o_id, selectCouponId)
				} else {
					console.log('bottomShow false')
					this.$set(this, 'bottomShow', false);
					this.$set(this, 'couponId', 0);
					this.$set(this, 'checkId', 0);
					this.coupon.list = []
					this.ChangCouponsClone()
				}
				
				// this.checkId = item.order_id
				// if (this.checkId !== 0) {
				// 	this.bottomShow = true
				// }
				
				
			},
			
			
			onChangeFun: function(e) {
				let opt = e;
				let action = opt.action || null;
				let value = opt.value != undefined ? opt.value : null;
				action && this[action] && this[action](value);
			},
			payCheck: function(value) {
				const that = this
				this.pay_close = false;
				
				getStageBillPay2(that.o_id, {
					couponId: that.couponId,
					order_id: that.selectIds,
					paytype: value
				}).then(res => {
					uni.hideLoading()
					if (value === 'alipay') {
						const prePayTn = res.data.result.jsConfig.prePayTn
						my.tradePay({
							tradeNO: prePayTn ? prePayTn : res.data.result.jsConfig.tradeNo,
							success: (resd) => {
								if (
								  resd.resultCode == "9000" ||
								  resd.resultCode == "8000" ||
								  resd.resultCode == "6004"
								) {
								  uni.showToast({
									title: '支付成功'
								  })
								  
								  that.$set(that, 'bottomShow', false);
								  that.$set(that, 'couponId', 0);
								  that.$set(that, 'checkId', 0);
								  that.ChangCouponsClone()
								  that.getServerData()
								  
								} else {
								  console.log(resd, "支付失败");
								}
							},
							fail: (resd) => {
								console.log(resd, "支付状态");
							}
						})
					} else if (value === 'yee_yjzf') {
						const url = res.data.result.jsConfig.cashierUrl
						uni.navigateTo({
							url: `/pages/annex/web_view/index?url=${url}`
						});
					}
					
					
					// my.tradePay({
					// 	tradeNO: res.data.result.jsConfig.tradeNo,
					// 	success: (resd) => {
					// 		if (
					// 		  resd.resultCode == "9000" ||
					// 		  resd.resultCode == "8000" ||
					// 		  resd.resultCode == "6004"
					// 		) {
					// 		  uni.showToast({
					// 		  	title: '支付成功'
					// 		  })
					// 		  that.$set(that, 'bottomShow', false);
					// 		  that.$set(that, 'couponId', 0);
					// 		  that.$set(that, 'checkId', 0);
					// 		  that.ChangCouponsClone()
					// 		  that.getServerData()
						
					// 		} else {
					// 		  console.log(resd, "支付失败");
					// 		}
					// 	},
					// 	fail: (resd) => {
					// 		console.log(resd, "支付状态");
					// 	}
					// })
				})
				
			},
			payClose: function() {
				this.pay_close = false;
			},
			
			toPay() {
				
				
				const that = this
				
				let selectIds = []
				
				if (this.waitPay.waitPay) {
					this.waitPay.list.forEach((item, index) => {
						if (item.select) {
							selectIds.push(item.order_id)
						}
					})
				} else {
					this.wait_list.forEach((item, index) => {
						if (item.select) {
							selectIds.push(item.order_id)
						}
					})
				}
				
				if (selectIds.length > 0) {
				
					// if (this.appType == 2) {
					// 	this.$set(this, 'pay_close', true);
					// } else {
						uni.showLoading({
							title: '支付中'
						})
						
						console.log(that.o_id)
						
						getStageBillPay2(that.o_id, {
							couponId: that.couponId,
							order_id: selectIds
						}).then(res => {
							uni.hideLoading()
							const prePayTn = res.data.result.jsConfig.prePayTn
							my.tradePay({
								tradeNO: prePayTn ? prePayTn : res.data.result.jsConfig.tradeNo,
								success: (resd) => {
									if (
									  resd.resultCode == "9000" ||
									  resd.resultCode == "8000" ||
									  resd.resultCode == "6004"
									) {
									  uni.showToast({
									  	title: '支付成功'
									  })
									  that.$set(that, 'bottomShow', false);
									  that.$set(that, 'couponId', 0);
									  that.$set(that, 'checkId', 0);
									  that.ChangCouponsClone()
									  that.getServerData()
								
									} else {
									  console.log(resd, "支付失败");
									}
								},
								fail: (resd) => {
									console.log(resd, "支付状态");
								}
							})
						})
					// }
					
				} else {
					uni.showToast({
						title: '请选择待还账单'
					})
					return
				}
			},
			getServerData() {
			    const that = this
			    this.couponCount = 0
			    this.couponId = 0
			    getOrderDetail(this.order_id).then(res => {
			    	that.$set(that, 'orderInfo', res.data);
			    	
			    	getStageBillList(this.o_id).then(res => {
			    		that.$set(that, 'rentInfo', res.data);
			    		that.opts.title.name = res.data.rent_price;
			    		that.wait_list = that.rentInfo.now_wait_list
			    		that.waitPay.list = that.rentInfo.did_wait_list
			    		let selectCouponId = []
			    		that.wait_list.forEach((item, index) => {
			    			if (item.is_first == 1) {
			    				item.select = true
			    				selectCouponId.push(item.id)
			    			} else {
			    				item.select = false
			    			}
			    		})
			    		
			    	
			    		if (selectCouponId.length > 0) {
			    			this.bottomShow = true
			    			this.couponId = 0
			    			this.getCouponList(this.o_id, selectCouponId)
			    		}
			    		
			    		if (this.isFirst && this.type == 1)  {
			    			this.waitPay.waitPay = true
			    		} else {
			    			this.waitPay.waitPay = false
			    		}
			    		
			    		this.isFirst = false
			    		
			    		this.loaded = true
			    	})
			    })
			},
		}
	};
</script>

<style lang="scss">
	page {
		background-color: #F5F7FA;
	}

	.my-bill-detail {
		padding: 0 24rpx 180rpx 24rpx;
		
		.header {
			margin-top: 24rpx;
			background-color: #fff;
			border-radius: 16rpx;
			
			.banner {
				width: 100%;
				height: 304rpx;
				position: relative;
				
				.content {
					height: 100%;
					width: 100%;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					border-radius: 16rpx;
					color: #fff;
					font-size: 24rpx;
					
					.middle-txt {
						margin-top: 48rpx;
						font-size: 56rpx;
						font-weight: bold;
					}
					
					.bottom-txt {
						margin-top: 32rpx;
						color: rgba(255,255,255,0.72);
					}
					
				}
				
				.blue {
					background: linear-gradient(135deg, #7296CC 0%, #517AB8 100%);
				}
				
				.green {
					background: linear-gradient(135deg, #39CCC2 0%, #17C2B6 100%);
				}
				
				.red {
					background: linear-gradient(135deg, #FF5347 0%, #EB261C 100%);
				}
				
				.repaid0 {
					position: absolute;
					right: 0;
					top: 32rpx;
					width: 80rpx;
					height: 72rpx;
					border-top-left-radius: 8rpx;
					border-bottom-left-radius: 8rpx;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					background: linear-gradient(45deg, rgba(255,255,255,0.72) 0%, #FFFFFF 76%);
					font-size: 24rpx;
					color: #517AB8;
				}
				
				.repaid1 {
					position: absolute;
					right: 0;
					top: 32rpx;
					width: 80rpx;
					height: 72rpx;
					border-top-left-radius: 8rpx;
					border-bottom-left-radius: 8rpx;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					background: linear-gradient(45deg, rgba(255,255,255,0.72) 0%, #FFFFFF 76%);
					font-size: 24rpx;
					color: #39CCC2;
				}
				
				
				.repaid2 {
					position: absolute;
					right: 0;
					top: 32rpx;
					width: 80rpx;
					height: 72rpx;
					border-top-left-radius: 8rpx;
					border-bottom-left-radius: 8rpx;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					background: linear-gradient(45deg, rgba(255,255,255,0.72) 0%, #FFFFFF 76%);
					font-size: 24rpx;
					color: #EB261C;
				}
			}
		}
		
		.rent-info {
			width: 100%;
			height: 184rpx;
			display: flex;
			align-items: center;
			
			.h-line {
				width: 2rpx;
				height: 72px;
				background: #F5F5F5;
			}
			
			.item {
				flex: 1;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				
				.name {
					font-weight: 500;
					color: #1F1F1F;
					font-size: 32rpx;
				}
				
				.txt {
					margin-top: 24rpx;
					font-weight: 500;
					color: #999999;
				}
			}
		}

		.mb-section {
			margin-top: 24rpx;
			padding: 0 24rpx;
			background-color: #fff;
			border-radius: 16rpx;
		}

		.order-id {
			height: 96rpx;
			display: flex;
			align-items: center;
			font-size: 24rpx;
			border-bottom: 2rpx solid #f5f5f5;
			color: #1F1F1F;
			
			.num {
				color: #999;
			}
		}

		.bill-info {
			display: flex;
			margin-top: 24rpx;
			padding-bottom: 32rpx;

			.b-pic {
				width: 240rpx;
				height: 240rpx;
				border-radius: 16rpx;
				border: 2rpx solid #F5F5F5;
			}

			.spec-info {
				flex: 1;
				margin-left: 24rpx;

				.title {
					margin-bottom: 16rpx;
					font-size: 32rpx;
					font-weight: bold;
					color: #1F1F1F;
					line-height: 48rpx;
				}

				.sub {
					font-size: 24rpx;
					font-weight: 400;
					color: #999999;
					line-height: 40rpx;
					word-break: break-all;

					&.mt8 {
						margin-top: 8rpx;
					}
				}
			}
		}

		.chart-info {
			border-top: 2rpx solid #F5F5F5;
			padding-top: 32rpx;
			display: flex;
			
			.left-chart {
				width: 240rpx;
				height: 240rpx;
			}
			
			.right-content {
				margin-left: 24rpx;
				padding-top: 56rpx;
				display: flex;
				flex-wrap: wrap;
				flex: 1;
				
				.total-item {
					width: 50%;
					
					.num {
						font-size: 36rpx;
						font-weight: bold;
						color: #FFA85C;
					}
					
					.name {
						margin-top: 16rpx;
						font-size: 24rpx;
						font-weight: 400;
						color: #999999;
						line-height: 24rpx;
					}
				}
			}
			
			.wait {
				display: flex;
				align-items: center;
				justify-content: center;
				margin-top: 24rpx;
				width: 304rpx;
				height: 44rpx;
				border-radius: 22rpx;
				background: rgba(255,39,31,0.08);
				font-size: 24rpx;
				font-weight: 400;
				color: #FF271F;
			}
		}
	
		.p-title {
			margin-top: 8rpx;
			font-size: 32rpx;
			font-weight: bold;
			color: #1F1F1F;
			line-height: 32rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-between;
			
			.title-right {
				font-size: 24rpx;
				color: #1F1F1F;
				display: flex;
				flex-direction: row;
				align-items: center;
				font-weight: 400;
				.icon-overdue {
					width: 32rpx;
					height: 32rpx;
					margin-right: 8rpx;
				}
			}
		}
		
		
		.top-box {
			margin-top: 32rpx;
			display: flex;
			align-items: center;
			
			.left {
				flex: 1;
				
				.sub-title {
					font-size: 24rpx;
					color: #1F1F1F;
					line-height: 24rpx;
				}
				
				.sum {
					margin-top: 16rpx;
					font-size: 56rpx;
					font-weight: bold;
					color: #1F1F1F;
					line-height: 56rpx;
				}
			}
			
			.to-pay {
				width: 176rpx;
				height: 76rpx;
				line-height: 76rpx;
				border-radius: 44rpx;
				border: 2rpx solid #39CCC2;
				font-size: 28rpx;
				font-weight: bold;
				color: #39CCC2;
				text-align: center;
			}
		}
		
		.note {
			padding-bottom: 32rpx;
			margin-top: 16rpx;
			font-size: 24rpx;
			font-weight: 400;
			color: #999999;
			line-height: 34rpx;
			border-bottom: 2rpx solid #F5F5F5;
		}
	
		.data-list {
			.item {
				padding:  24rpx 0;
				
				&~.item {
					border-top: 2rpx solid #F5F5F5;
				}
				
				.content {
					display: flex;
					flex-direction: row;
					align-items: center;
					height: 144rpx;
					
					.left {
						height: 144rpx;
						width: 72rpx;
						display: flex;
						flex-direction: column;
						align-items: center;
						justify-content: center;
						margin-right: 10rpx;
					}
					
					.middle {
						flex: 1;
						
						.report {
							margin-left: 8rpx;
							background: rgba(22,184,108,0.08);
							border-radius: 2rpx;
							color: #16B86C;
							font-weight: 400;
							font-size: 24rpx;
							padding: 4rpx 8rpx;
						}
						
						.reported {
							margin-left: 8rpx;
							background: rgba(255,39,31,0.08);
							border-radius: 4rpx;
							color: #FF271F;
							font-weight: 400;
							font-size: 24rpx;
							padding: 4rpx 8rpx;
						}
						
						.count {
							font-size: 28rpx;
							font-weight: bold;
							color: #1F1F1F;
						}
						
						.time {
							margin-top: 24rpx;
							font-size: 24rpx;
							font-weight: 400;
							color: #999999;
							line-height: 24rpx;
							
							.red {
								color: #FF271F;
							}
							
							.green {
								color: #16B86C;
							}
						}
					}
					
					.right {
						text-align: right;
						.num {
							font-size: 36rpx;
						}
						.money-add {
							margin-top: 20rpx;
							color: #999;
							font-size: 24rpx;
						}
					}
				}
				
				
				
				
				.stage {
					display: flex;
					justify-content: space-between;
					align-items: center;
					
					
					text {
						font-size: 28rpx;
						font-weight: bold;
						color: #1F1F1F;
					}
					
					.num {
						font-size: 36rpx;
					}
				}
			
				.info {
					display: flex;
					justify-content: space-between;
					align-items: center;
					margin-top: 24rpx;
					
					.time {
						font-size: 24rpx;
						font-weight: 400;
						color: #999999;
						line-height: 24rpx;
						
						.red {
							color: #FF271F;
						}
						
						.green {
							color: #16B86C;
						}
					}
					
					.price {
						font-size: 24rpx;
						font-weight: 400;
						color: #999999;
					}
				}
			}
		}
	
		.mb-flex-box {
			position: fixed;
			left: 0;
			bottom: 0;
			z-index: 100;
			width: 100%;
			background-color: #fff;
			padding-bottom: 48rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			border-top-left-radius: 30rpx;
			border-top-right-radius: 30rpx;
			// justify-content: space-between;
			
			.coupon-list {
				width: 100%;
				height: 96rpx;
				display: flex;
				flex-direction: row;
				align-items: center;
				justify-content: space-between;
				// margin-bottom: 24rpx;
				
				
				.name {
					color: #1F1F1F;
					font-size: 32rpx;
					font-weight: bold;
				}
				
				.num {
					padding: 4rpx;
					font-size: 24rpx;
					color: #FF1F2E;
					background: rgba(255,31,46,0.08);
				}
				
				.emptyNum {
					padding: 4rpx;
					font-size: 24rpx;
					color: #999;
					background: #F5F5F5;
				}
			}
			
			.btn {
				display: flex;
				align-items: center;
				justify-content: center;
				// width: 330rpx;
				flex: 1;
				height: 76rpx;
				border-radius: 44rpx;
				font-size: 28rpx;
				font-weight: bold;
				
				&.prev {
					color: #39CCC2;
					background: rgba(57,204,194,0.08);
				}
				
				&.next {
					color: #fff;
					background: linear-gradient(90deg, #71EBDA 0%, #39CCC2 100%);
				}
			}
		}
	}
	
	.to-pay {
		width: 156rpx;
		height: 60rpx;
		line-height: 60rpx;
		border-radius: 44rpx;
		border: 2rpx solid #39CCC2;
		font-size: 24rpx;
		font-weight: bold;
		color: #39CCC2;
		text-align: center;
	}
	
	.check-img {
		width: 40rpx;
		height: 40rpx;
	}
	
	.overdue {
		background: linear-gradient(135deg, #FF5347 0%, #EB261C 100%);
		color: #fff;
		border-radius: 8px;
		font-weight: normal;
		padding: 8rpx;
		font-size: 24rpx;
		margin-left: 20rpx;
	}
	
	.bottom-btn {
		padding-top: 24rpx;
		width: 680rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
	}
</style>